package com.ts.api.common.redis;

import com.gitee.apanlh.util.cache.redis.RedisKeyBuilder;
import com.gitee.apanlh.util.cache.redis.api.RedisString;
import org.springframework.stereotype.Component;

/**
 *  API分发手机号掩码模式相关key
 *
 *
 *  @author Pan
 */
@Component
public class ApiMatchPhoneMaskRedisKey {

    /** API渠道-上游-我方接入/对方接入，保存撞库时唯一id字段 */
    public static final RedisString API_CHANNEL_DATA_EXCHANGE_PHONE_MASK_APPLY_ID = RedisKeyBuilder.builder().withKeys("api_channel_data_exchange_phone_mask_apply_id").buildString();
    /** 自有渠道-撞库保存进件id */
    public static final RedisString CHANNEL_DATA_EXCHANGE_PHONE_MASK_APPLY_ID = RedisKeyBuilder.builder().withKeys("channel_data_exchange_phone_mask_apply_id").buildString();

    /**
     *  获取API渠道-唯一编号
     *
     *  @param  loanChannelId   渠道主键id
     *  @param  applyId         进件id
     *  @return String
     */
    public static String getApiChannelDataExchangeReqIdKey(Long loanChannelId, String applyId) {
        return loanChannelId.toString() + "_" + applyId;
    }

    /**
     *  获取撞库-保存applyId
     *
     *  @param  loanChannelId   渠道主键id
     *  @param  productId       主体主键
     *  @param  productPlanId   主体计划主键
     *  @param  phoneMd5        手机号md5
     *  @return String
     */
    public static String getChannelDataExchangeApplyIdKey(Long loanChannelId, Long productId, Long productPlanId, String phoneMd5) {
        return loanChannelId.toString() + "_" + productId + "_" + productPlanId + "_" + phoneMd5;
    }
}
